#ifndef _TEXTURE_CONTAINER_H_
#define _TEXTURE_CONTAINER_H_

#ifdef _WIN32
#pragma once
#endif

/**
 * A container to hold and interact with all textures. 
 *
 * 04/04/2012 - Steven Hartin - Made sure that only one instance of a texture 
 *     is loaded based off the key. If the texture is already loaded, increment
 *     the reference count and return the texture. Commented the file. 
 * 02/03/2012 - Stephen Gore - Created the class structure, implemented from 
 *                             UML
 *                           - Created the header file. 
 *                           - Defined all functions. 
 *                           - Made sure all functions and parameters that need 
 *                             to be are const. 
 */

#include <map>
#include <string>

#include "d3dx9.h"

#include "texture.h"

using std::map;
using std::string;
using std::pair;

class CTextureContainer{

public :            
    // Get the instance of the container.
    static CTextureContainer* getInstance();

    // Container controls
    CTexture* addTexture(const string &key, const string &path, 
                        LPDIRECT3DDEVICE9 device, int nWidth=D3DPOOL_DEFAULT,
                        int nHeight=D3DPOOL_DEFAULT);
    CTexture* addTexture(const string &key, LPDIRECT3DTEXTURE9 texture,
                         int nWidth=D3DPOOL_DEFAULT, 
                         int nHeight=D3DPOOL_DEFAULT);

    bool removeTexture(const string &key);
    CTexture* getTexture(const string &key) const;

    void clearTextures();

private:
    // Constructors.
    CTextureContainer(){}
    CTextureContainer(const CTextureContainer &rhs) {}

    // Destuctor.
    ~CTextureContainer();

    // Assignment operator.
    CTextureContainer &operator=(const CTextureContainer&) {}

    // The array of textures 
    map<string,CTexture*> m_arrTextures;    
};
#endif